package Test3;

import java.util.Arrays;

class Student implements Comparable<Student>{
    String name;
    int age;
    double score;

    public Student(String name, int age, double score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", score=" + score +
                '}';
    }

    @Override
    public int compareTo(Student o) {
        return this.name.compareTo(o.name);
    }
}
public class test3 {
    public static void main(String[] args) {
        Student[] students = new Student[3];
        students[0] = new Student("小hhh", 15, 85.5);
        students[1] = new Student("小hhhh", 12, 80);
        students[2] = new Student("小h", 10, 98);
        System.out.println(Arrays.toString(students));
        Arrays.sort(students);
        System.out.println(Arrays.toString(students));
    }
}
